/************************************************************************

								Heroes IV
					  Copyright 2000, The 3DO Company

	------------------------------------------------------------------
  							 script_simple_expression.h

	$Header: /heroes4/script_simple_expression.h $

	$NoKeywords: $

 ************************************************************************/

#if !defined( SCRIPT_SIMPLE_EXPRESSION_H_INCLUDED )
#define SCRIPT_SIMPLE_EXPRESSION_H_INCLUDED

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "abstract_script_expression.h"
#include "script_expression_type.h"

// --------------------------------------------------------------------------
// t_script_simple_expression class template
// --------------------------------------------------------------------------

template < typename t_base >
class t_script_simple_expression : public t_base
{
public:
	// Member functions
	virtual bool	read( std::streambuf& stream, int version );
	virtual bool	read_from_map(
						std::streambuf &	stream,
						int					format_version );
	virtual bool	write( std::streambuf& stream ) const;
};

// --------------------------------------------------------------------------
// t_script_simple_expression members
// --------------------------------------------------------------------------

// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
template < typename t_base >
bool t_script_simple_expression< t_base >::read_from_map(
	std::streambuf &	stream,
	int					format_version )
{
	return true;
}

// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
template < typename t_base >
bool t_script_simple_expression< t_base >::read( std::streambuf& stream, int version )
{
	return true;
}

// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
template < typename t_base >
bool t_script_simple_expression< t_base >::write( std::streambuf& stream ) const
{
	return t_base::write( stream );
}

// --------------------------------------------------------------------------
// t_script_simple_numeric_expression type
// --------------------------------------------------------------------------

typedef	t_script_simple_expression<
			t_abstract_script_numeric_expression >	t_script_simple_numeric_expression;

class t_script_expression_day : 
	public t_script_simple_numeric_expression
{
public:	
	virtual t_result	evaluate(t_expression_context_global const& context) const;
};

class t_script_expression_day_of_week : 
	public t_script_simple_numeric_expression
{
public:	
	virtual t_result	evaluate(t_expression_context_global const& context) const;
};

class t_script_expression_week : 
	public t_script_simple_numeric_expression
{
public:	
	virtual t_result	evaluate(t_expression_context_global const& context) const;
};

class t_script_expression_week_of_month : 
	public t_script_simple_numeric_expression
{
public:	
	virtual t_result	evaluate(t_expression_context_global const& context) const;
};

class t_script_expression_month : 
	public t_script_simple_numeric_expression
{
public:	
	virtual t_result	evaluate(t_expression_context_global const& context) const;
};


SPECIALIZE_SCRIPT_NUMERIC_EXPRESSION( k_script_numeric_day, t_script_expression_day );
SPECIALIZE_SCRIPT_NUMERIC_EXPRESSION( k_script_numeric_day_of_week, t_script_expression_day_of_week );
SPECIALIZE_SCRIPT_NUMERIC_EXPRESSION( k_script_numeric_week, t_script_expression_week );
SPECIALIZE_SCRIPT_NUMERIC_EXPRESSION( k_script_numeric_week_of_month, t_script_expression_week_of_month );
SPECIALIZE_SCRIPT_NUMERIC_EXPRESSION( k_script_numeric_month, t_script_expression_month );

// --------------------------------------------------------------------------
// t_script_simple_boolean_expression type
// --------------------------------------------------------------------------

typedef	t_script_simple_expression<
			t_abstract_script_boolean_expression >	t_script_simple_boolean_expression;

class t_script_expression_true : 
	public t_script_simple_boolean_expression
{
public:	
	virtual t_result	evaluate(t_expression_context_global const& context) const;
};

class t_script_expression_false : 
	public t_script_simple_boolean_expression
{
public:	
	virtual t_result	evaluate(t_expression_context_global const& context) const;
};

SPECIALIZE_SCRIPT_BOOLEAN_EXPRESSION( k_script_boolean_true, t_script_expression_true );
SPECIALIZE_SCRIPT_BOOLEAN_EXPRESSION( k_script_boolean_false, t_script_expression_false );

#endif // !defined( SCRIPT_SIMPLE_EXPRESSION_H_INCLUDED )
